<script setup lang="ts">
	import { reactive } from "vue";
	import { getCertificationInfo } from "@/api/user";
	import { onShow } from "@dcloudio/uni-app";
	import { useStore } from "vuex";
	
	const store = useStore();
	const state = reactive({
		model: {}
	});
	onShow(async () => {
		const res = await getCertificationInfo({openid: store.state.user.openId});
		console.log(res);
		state.model = res.data;
	})
</script>

<template>
	<view class="certification-info">
		<xx-title title="认证信息" />
		<view class="certification-info-body">
			<view class="certification-title">实名基本信息</view>
			<view class="certification-info-box">
				<view class="certification-info-item">
					<view class="info-item-label">姓名：</view>
					<view class="info-item-value">{{state.model.name}}</view>
				</view>
				<view class="certification-info-item">
					<view class="info-item-label">性别：</view>
					<view class="info-item-value">
						{{state.model.sex}}
					</view>
				</view>
				<view class="certification-info-item">
					<view class="info-item-label">国籍：</view>
					<view class="info-item-value">
						{{state.model.nationality}}
					</view>
				</view>
				<view class="certification-info-item">
					<view class="info-item-label">证件类型：</view>
					<view class="info-item-value">
						{{state.model.doType}}
					</view>
				</view>
				<view class="certification-info-item">
					<view class="info-item-label">证件号码：</view>
					<view class="info-item-value">
						{{state.model.idCard}}
					</view>
				</view>
				<view class="certification-info-item">
					<view class="info-item-label">地址：</view>
					<view class="info-item-value">
						{{state.model.address}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<style scoped lang="scss">
	.certification-info {
		background-color: #F5F5F5;
		padding: 20rpx;
		box-sizing: border-box;
		min-height: 100vh;

		.certification-title {
			padding: 20rpx;
			width: 100%;
			box-sizing: border-box;
			color: #FFFFFF;
			text-align: center;
			font-weight: 500;
			font-size: 32rpx;
			border-radius: 8rpx 8rpx 16rpx 16rpx;
			background: linear-gradient(270deg, #92C75B 0%, #89BA55 100%);

			text {
				font-size: 28rpx;
				margin: 0 10rpx;
			}

			.is-audio {
				background-color: linear-gradient(270deg, #f31919 0%, #cb0202 100%);
			}
		}

		.certification-info-body {
			padding: 40rpx 20rpx;
			box-sizing: border-box;
			background-color: #FFFFFF;
			border-radius: 16rpx 16rpx 8rpx 8rpx;

			.certification-tips {
				display: flex;
				align-items: center;
				justify-content: center;

				text {
					font-size: 28rpx;
				}
			}

			.certification-info-box {
				background-color: #F7F7F7;
				padding: 20rpx 24rpx;
				border-radius: 16rpx;

				.certification-info-item {
					display: flex;
					justify-content: space-between;
					align-items: flex-start;
					padding-bottom: 20rpx;

					&:last-child {
						padding-bottom: 0;
					}

					.info-item-label {
						color: #505363;
						font-size: 24rpx;
					}

					.info-item-value {
						color: #505363;
						font-size: 24rpx;

						image {
							width: 150rpx;
							height: 150rpx;
							border-radius: 10rpx;
						}
					}
				}
			}

			.certification-btn {
				margin-top: 20rpx;
				padding-top: 40rpx;
				border-top: 1rpx solid #F5F5F5;
				display: flex;
				justify-content: center;
				align-items: center;

				&:last-child {
					border-right: none;
				}

				.btn-item {
					width: calc(100% / 3);
					text-align: center;
					border-right: 1px solid #F7F7F7;

					&:last-child {
						border-right: none;
					}

					image {
						width: 30rpx;
					}

					.title {
						color: #818496;
						font-size: 24rpx;
					}
				}
			}
		}
	}

	.school-tips {
		width: 100%;
		padding: 12rpx 16rpx;
		margin-bottom: 20rpx;
		box-sizing: border-box;
		border-radius: 8rpx;
		position: relative;
		display: flex;
		background-color: #fdf6ec;
		color: #e6a23c;

		.school-right {
			width: calc(100% - 28rpx);
			margin-left: 4rpx;
			font-size: 26rpx;

			.tips {
				font-size: 28rpx;
				margin-bottom: 10rpx;
			}
		}
	}
</style>